<template>
  <div class="app-container">
    <el-tabs type="border-card">
      <el-tab-pane label="审核管理">
        <el-form
          :model="queryParams"
          ref="queryForm"
          size="small"
          :inline="true"
          v-show="showSearch"
          label-width="68px"
        >
          <el-form-item label="关键词" prop="title">
            <el-input
              v-model="queryParams.title"
              placeholder="请输入状态"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="选择赛事" prop="competitionId">
            <el-select
              v-model="queryParams.competitionId"
              placeholder="请选择"
              clearable
              @keyup.enter.native="handleQuery"
            >
              <el-option
                v-for="item in playList"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <!-- <el-form-item label="队伍名称" prop="title">
        <el-input
          v-model="queryParams.title"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
     -->
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </el-form>

        <!-- <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['system:apply:add']"
              >新增</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['system:apply:edit']"
              >修改</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDelete"
              v-hasPermi="['system:apply:remove']"
              >删除</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handleExport"
              v-hasPermi="['system:apply:export']"
              >导出</el-button
            >
          </el-col>
          <right-toolbar
            :showSearch.sync="showSearch"
            @queryTable="getList"
          ></right-toolbar>
        </el-row> -->

        <el-table
          v-loading="loading"
          :data="applyList"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55" align="center" />
          <!-- <el-table-column label="id" align="center" prop="id" /> -->
          <el-table-column
            label="报名信息(队伍-赛事)"
            align="center"
            prop="title"
          />
          <!-- <el-table-column label="报名信息" align="center" prop="name" width="300">
        <template slot-scope="scope">
          <span>{{ scope.row.createBy }}</span>
        </template>
      </el-table-column> -->
          <el-table-column label="赛事" align="center" prop="competitionName" />
          <el-table-column
            label="报名时间"
            align="center"
            prop="time"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.joinTime) }}</span>
            </template>
          </el-table-column>

          <el-table-column label="报名状态" align="center" prop="status">
            <template slot-scope="scope">
              <el-popover trigger="hover" placement="top">
                <div slot="reference" class="name-wrapper">
                  <el-tag
                    v-show="scope.row.status === '已退回'"
                    size="medium"
                    type="danger"
                    >{{ scope.row.status }}</el-tag
                  >

                  <el-tag
                    v-show="scope.row.status === '待审核'"
                    size="medium"
                    type="warning"
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '已通过'"
                    size="medium"
                    type="success"
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '待缴费'"
                    size="medium"
                    type=""
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '草稿'"
                    size="medium"
                    type="info"
                    >{{ scope.row.status }}</el-tag
                  >
                </div>
              </el-popover>
            </template>
          </el-table-column>
          <!-- <el-table-column label="领队ids" align="center" prop="leaderIds" />
      <el-table-column label="教练员ids" align="center" prop="coachIds" />
      <el-table-column label="随队裁判ids" align="center" prop="refereeIds" />
      <el-table-column label="随队人员ids" align="center" prop="otherIds" /> -->

          <!-- <el-table-column label="${comment}" align="center" prop="entryCost" />
      <el-table-column label="费用" align="center" prop="cost" /> -->

          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['system:apply:edit']"
                >审核</el-button
              >
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['system:apply:remove']"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.page"
          :limit.sync="queryParams.rowsPerPage"
          @pagination="getList"
        />

        <!-- 添加或修改报名对话框 -->
        <el-dialog
          :close-on-click-modal="false"
          :title="title"
          :visible.sync="open"
          width="1000px"
          append-to-body
          class="scrollbar"
        >
          <el-scrollbar style="height: 100%">
            <el-form ref="form" :model="form" :rules="rules" label-width="80px">
              <el-row>
                <el-col :span="10">
                  <el-form-item label="队伍名称" prop="title">
                    <el-input
                      v-model="form.title"
                      placeholder="请输入队伍名称"
                      disabled
                    />
                  </el-form-item>
                </el-col>

                <!-- <el-form-item label="赛事名称/报名项目" prop="competitionName">
            <el-input
              v-model="form.competitionName"
              placeholder="请输入项目名称"
            />
          </el-form-item> -->
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="报名时间" prop="joinTime">
                    <el-date-picker
                      clearable
                      v-model="form.joinTime"
                      type="date"
                      value-format="yyyy-MM-dd"
                      placeholder="请选择报名时间"
                      disabled
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>
              <!-- <el-row>
                <el-col :span="10">
                  <el-form-item
                    v-show="form.filePayUrl"
                    label="队伍logo"
                    prop="picture"
                  >
                    <img
                      :src="BaseUrl + form.filePayUrl"
                      style="width: 300px; height: 150px"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="14">
                  <el-form-item> </el-form-item>
                </el-col>
              </el-row> -->
              <el-row>
                <el-col :span="10">
                  <el-form-item
                    v-show="form.filePayUrl"
                    label="缴费截图"
                    prop="picture"
                  >
                    <img
                      :src="BaseUrl + form.filePayUrl"
                      style="width: 300px; height: 150px"
                    />
                  </el-form-item>
                  <el-form-item
                    v-show="!form.filePayUrl"
                    label="缴费截图"
                    prop="picture"
                  >
                    <el-tag type="danger">未上传</el-tag>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="费用" prop="cost">
                    <el-input
                      v-model="form.cost"
                      type="input"
                      placeholder="请输入内容"
                      disabled
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="单间房间" prop="coachIds">
                    <el-input
                      v-model="form.singleRoomPresonSum"
                      type="input"
                      placeholder="请输入内容"
                      disabled
                    />
                  </el-form-item>
                </el-col>
                <!-- <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col> -->
                <el-col :span="8">
                  <el-form-item label="标间房间" prop="refereeIds">
                    <el-input
                      v-model="form.standardRoomPersonSum"
                      type="input"
                      placeholder="请输入内容"
                      disabled
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="拼房信息" prop="pinFangType">
                    <el-input
                      v-model="form.pinFangType"
                      type="input"
                      placeholder="请输入内容"
                      disabled
                    />
                  </el-form-item>
                </el-col>
              </el-row>

              <el-divider>领队信息</el-divider>
              <el-table :data="form.leaders" border style="width: 100%">
                <el-table-column prop="name" label="领队姓名" width="180">
                </el-table-column>
                <el-table-column prop="sex" label="性别" width="180">
                </el-table-column>
                <el-table-column prop="age" label="年龄" width="180">
                </el-table-column>
                <el-table-column prop="tel" label="电话" width="180">
                </el-table-column>
                <el-table-column prop="idCard" label="身份证">
                </el-table-column>
              </el-table>
              <el-divider>教练员</el-divider>
              <el-table :data="form.coachs" border style="width: 100%">
                <el-table-column prop="name" label="教练员姓名" width="180">
                </el-table-column>
                <el-table-column prop="sex" label="性别" width="180">
                </el-table-column>
                <el-table-column prop="age" label="年龄" width="180">
                </el-table-column>
                <el-table-column prop="tel" label="电话" width="180">
                </el-table-column>
                <el-table-column prop="idCard" label="身份证">
                </el-table-column>
              </el-table>
              <el-divider>随队裁判</el-divider>
              <el-table :data="form.referees" border style="width: 100%">
                <el-table-column prop="name" label="裁判姓名" width="180">
                </el-table-column>
                <el-table-column prop="sex" label="性别" width="180">
                </el-table-column>
                <el-table-column prop="age" label="年龄" width="180">
                </el-table-column>
                <el-table-column prop="tel" label="电话" width="180">
                </el-table-column>
                <el-table-column prop="idCard" label="身份证">
                </el-table-column>
              </el-table>
              <el-divider>随队人员</el-divider>
              <el-table :data="form.others" border style="width: 100%">
                <el-table-column prop="name" label="随队人员姓名" width="180">
                </el-table-column>
                <el-table-column prop="sex" label="性别" width="180">
                </el-table-column>
                <el-table-column prop="age" label="年龄" width="180">
                </el-table-column>
                <el-table-column prop="tel" label="电话" width="180">
                </el-table-column>
                <el-table-column prop="idCard" label="身份证">
                </el-table-column>
              </el-table>

              <!-- <el-form-item label="领队ids" prop="leaderIds">
          <el-input
            v-model="form.leaderIds"
            type="textarea"
            placeholder="请输入内容"
          />
        </el-form-item> -->
              <div>
                <el-divider>比赛项目</el-divider>
                <el-collapse>
                  <el-collapse-item
                    v-for="item in form.projects"
                    :key="item.id"
                    :title="item.name"
                  >
                    <template slot="title">
                      {{ item.type }} - {{ item.projectName }} -
                      {{ item.groups }}
                    </template>
                    <div>运动员信息： 姓名——性别——年龄——身份证——电话</div>
                    <div
                      v-for="tag in item.athletes"
                      :key="tag.index"
                      type="info"
                      size="small"
                    >
                      <el-tag type="info">
                        {{
                          tag.name +
                          "—" +
                          tag.sex +
                          "—" +
                          tag.age +
                          "—" +
                          tag.idCard +
                          "—" +
                          tag.tel
                        }}
                      </el-tag>
                    </div>
                    <div>
                      比赛音乐：<el-tag>{{ item.fileMusicName }}</el-tag>
                    </div>
                  </el-collapse-item>
                </el-collapse>
              </div>
              <el-divider>审核信息</el-divider>
              <el-form-item label="报名状态" prop="status">
                <el-popover trigger="hover" placement="top">
                  <div slot="reference" class="name-wrapper">
                    <el-tag
                      v-show="form.status === '已退回'"
                      size="medium"
                      type="danger"
                      >{{ form.status }}</el-tag
                    >

                    <el-tag
                      v-show="form.status === '待审核'"
                      size="medium"
                      type="warning"
                      >{{ form.status }}</el-tag
                    >
                    <el-tag
                      v-show="form.status === '已通过'"
                      size="medium"
                      type="success"
                      >{{ form.status }}</el-tag
                    >
                    <el-tag
                      v-show="form.status === '待缴费'"
                      size="medium"
                      type=""
                      >{{ form.status }}</el-tag
                    >
                    <el-tag
                      v-show="form.status === '草稿'"
                      size="medium"
                      type="info"
                      >{{ form.status }}</el-tag
                    >
                  </div>
                </el-popover>
              </el-form-item>
              <el-form-item label="审核" prop="status">
                <el-button
                  type="success"
                  :disabled="form.status === '已通过'"
                  @click="submitYes"
                  >审核通过</el-button
                >
                <el-button
                  type="warning"
                  :disabled="form.status === '待缴费'"
                  @click="noPay"
                  >待缴费</el-button
                >
                <el-button
                  type="danger"
                  :disabled="form.status === '已退回'"
                  @click="submitNo"
                  >退回</el-button
                >
              </el-form-item>
              <el-form-item label="审核失败退回原因">
                <el-input
                  v-model="submitForm.rejectCause"
                  placeholder="请输入审核失败原因"
                />
              </el-form-item>
            </el-form>
            <!-- <el-form ref="submitForm" :model="submitForm" label-width="80px">
      
        </el-form> -->
          </el-scrollbar>
          <div slot="footer" class="dialog-footer">
            <!-- <el-button type="primary" @click="submitForm">确 定</el-button> -->
            <el-button @click="cancel">关 闭</el-button>
          </div>
        </el-dialog></el-tab-pane
      >
      <el-tab-pane label="报名管理">
        <el-form
          :model="queryParams2"
          ref="queryApplyForm"
          size="small"
          :inline="true"
          v-show="showSearch"
          label-width="68px"
        >
          <el-form-item label="关键词" prop="title">
            <el-input
              v-model="queryParams2.title"
              placeholder="请输入标题"
              clearable
              @keyup.enter.native="handleQuery2"
            />
          </el-form-item>
          <el-form-item label="选择赛事" prop="competitionId">
            <el-select
              v-model="queryParams2.competitionId"
              placeholder="请选择"
              clearable
              @keyup.enter.native="handleQuery2"
            >
              <el-option
                v-for="item in playList"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="报名状态" prop="status">
            <el-select
              v-model="queryParams2.status"
              placeholder="请选择报名状态"
              clearable
              @keyup.enter.native="handleQuery2"
            >
              <el-option
                v-for="item in options"
                :key="item.id"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>

          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery2"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery2"
              >重置</el-button
            >
          </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
          <!-- <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['system:apply:add']"
              >新增</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single2"
              @click="handleUpdate"
              v-hasPermi="['system:apply:edit']"
              >修改</el-button
            >
          </el-col> -->
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple2"
              @click="handleDelete2"
              v-hasPermi="['system:apply:remove']"
              >删除</el-button
            >
          </el-col>
          <!-- <el-col :span="1.5">
            <el-button plain icon="el-icon-download"
              >参赛人员汇总表导出</el-button
            >
          </el-col> -->
          <el-col :span="1.5">
            <el-button plain icon="el-icon-download" @click="exportAthletes"
              >男女运动员表导出</el-button
            >
          </el-col>
          <!-- <el-col :span="1.5">
            <el-button plain icon="el-icon-download">联系人表导出</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button plain icon="el-icon-download">项目组别表导出</el-button>
          </el-col> -->
          <el-col :span="1.5">
            <el-button plain icon="el-icon-download" @click="exportDanWei"
              >参赛单位导出</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button plain icon="el-icon-download" @click="exportCost"
              >费用表导出</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button plain icon="el-icon-download" @click="exportReffers"
              >导出随队裁判</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button plain icon="el-icon-download" @click="exportZongHe"
              >综合报名表导出</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button plain icon="el-icon-download" @click="exportCoachs"
              >导出随队教练</el-button
            >
          </el-col>

          <el-col :span="1.5">
            <el-button plain icon="el-icon-download" @click="exportSuiDui"
              >随队人员导出</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button plain icon="el-icon-download" @click="exportAllPeople"
              >所有运动员导出</el-button
            >
          </el-col>
          <right-toolbar
            :showSearch.sync="showSearch"
            @queryTable="getListInfo"
          ></right-toolbar>
        </el-row>

        <el-table
          v-loading="loading2"
          :data="applyInfoList"
          @selection-change="handleSelectionChange2"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column
            label="报名信息(队伍-赛事)"
            align="center"
            prop="title"
          />
          <!-- <el-table-column label="报名信息" align="center" prop="name" width="300">
        <template slot-scope="scope">
          <span>{{ scope.row.createBy }}</span>
        </template>
      </el-table-column> -->
          <el-table-column label="赛事" align="center" prop="competitionName" />
          <el-table-column
            label="报名时间"
            align="center"
            prop="time"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.joinTime) }}</span>
            </template>
          </el-table-column>

          <el-table-column label="报名状态" align="center" prop="status">
            <template slot-scope="scope">
              <el-popover trigger="hover" placement="top">
                <div slot="reference" class="name-wrapper">
                  <el-tag
                    v-show="scope.row.status === '已退回'"
                    size="medium"
                    type="danger"
                    >{{ scope.row.status }}</el-tag
                  >

                  <el-tag
                    v-show="scope.row.status === '待审核'"
                    size="medium"
                    type="warning"
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '已通过'"
                    size="medium"
                    type="success"
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '待缴费'"
                    size="medium"
                    type=""
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '草稿'"
                    size="medium"
                    type="info"
                    >{{ scope.row.status }}</el-tag
                  >
                </div>
              </el-popover>
            </template>
          </el-table-column>
          <!-- <el-table-column label="领队ids" align="center" prop="leaderIds" />
      <el-table-column label="教练员ids" align="center" prop="coachIds" />
      <el-table-column label="随队裁判ids" align="center" prop="refereeIds" />
      <el-table-column label="随队人员ids" align="center" prop="otherIds" /> -->

          <!-- <el-table-column label="${comment}" align="center" prop="entryCost" />
      <el-table-column label="费用" align="center" prop="cost" /> -->

          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate2(scope.row)"
                v-hasPermi="['system:apply:edit']"
                >详情</el-button
              >
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete2(scope.row)"
                v-hasPermi="['system:apply:remove']"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="total2 > 0"
          :total="total2"
          :page.sync="queryParams2.page"
          :limit.sync="queryParams2.rowsPerPage"
          @pagination="getListInfo"
        />

        <!-- 添加或修改报名对话框 -->
        <el-dialog
          :close-on-click-modal="false"
          :title="title2"
          :visible.sync="open2"
          width="1000px"
          append-to-body
          class="scrollbar"
        >
          <el-scrollbar style="height: 100%">
            <el-form
              ref="form2"
              :model="form2"
              :rules="rules"
              label-width="80px"
            >
              <el-row>
                <el-col :span="10">
                  <el-form-item label="队伍名称" prop="title">
                    <el-input v-model="form2.title" disabled />
                  </el-form-item>
                </el-col>

                <!-- <el-form-item label="赛事名称/报名项目" prop="competitionName">
            <el-input
              v-model="form.competitionName"
              placeholder="请输入项目名称"
            />
          </el-form-item> -->
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="报名时间" prop="joinTime">
                    <el-date-picker
                      clearable
                      v-model="form2.joinTime"
                      type="date"
                      value-format="yyyy-MM-dd"
                      placeholder="请选择报名时间"
                      disabled
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="10">
                  <!-- <el-form-item
                    v-show="form2.filePayUrl"
                    label="缴费信息"
                    prop="picture"
                  >
                    <img
                      :src="BaseUrl + form2.filePayUrl"
                      style="width: 300px; height: 150px"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item
                    v-show="form.filePayUrl"
                    label="缴费截图"
                    prop="picture"
                  >
                    <img
                      :src="BaseUrl + form.filePayUrl"
                      style="width: 300px; height: 150px"
                    />
                  </el-form-item> -->
                  <el-col :span="10">
                    <el-form-item
                      v-show="form2.filePayUrl"
                      label="缴费截图"
                      prop="picture"
                    >
                      <img
                        :src="BaseUrl + form2.filePayUrl"
                        style="width: 300px; height: 150px"
                      />
                    </el-form-item>
                    <el-form-item
                      v-show="!form2.filePayUrl"
                      label="缴费截图"
                      prop="picture"
                    >
                      <el-tag type="danger">未上传</el-tag>
                    </el-form-item>
                  </el-col>
                </el-col>

                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="费用" prop="cost">
                    <el-input
                      v-model="form2.cost"
                      type="input"
                      placeholder="请输入内容"
                      disabled
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="单间房间" prop="coachIds">
                    <el-input
                      v-model="form2.singleRoomPresonSum"
                      type="input"
                      placeholder="请输入内容"
                      disabled
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="标间房间" prop="refereeIds">
                    <el-input
                      v-model="form2.standardRoomPersonSum"
                      type="input"
                      placeholder="请输入内容"
                      disabled
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="拼房" prop="pinFangType">
                    <el-input
                      v-model="form2.pinFangType"
                      type="input"
                      placeholder="请输入内容"
                      disabled
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-form-item label="报名状态" prop="status">
                <el-radio-group v-model="form2.status" disabled>
                  <el-radio-button label="草稿"></el-radio-button>
                  <el-radio-button label="待缴费"></el-radio-button>
                  <el-radio-button label="待审核"></el-radio-button>
                  <el-radio-button label="已退回"></el-radio-button>
                  <el-radio-button label="已通过"></el-radio-button>
                </el-radio-group>
              </el-form-item>

              <el-divider>领队信息</el-divider>
              <el-table :data="form2.leaders" border style="width: 100%">
                <el-table-column prop="name" label="领队姓名" width="180">
                </el-table-column>
                <el-table-column prop="sex" label="性别" width="180">
                </el-table-column>
                <el-table-column prop="age" label="年龄" width="180">
                </el-table-column>
                <el-table-column prop="tel" label="电话" width="180">
                </el-table-column>
                <el-table-column prop="idCard" label="身份证">
                </el-table-column>
              </el-table>
              <el-divider>教练员</el-divider>
              <el-table :data="form2.coachs" border style="width: 100%">
                <el-table-column prop="name" label="教练员姓名" width="180">
                </el-table-column>
                <el-table-column prop="sex" label="性别" width="180">
                </el-table-column>
                <el-table-column prop="age" label="年龄" width="180">
                </el-table-column>
                <el-table-column prop="tel" label="电话" width="180">
                </el-table-column>
                <el-table-column prop="idCard" label="身份证">
                </el-table-column>
              </el-table>
              <el-divider>随队裁判</el-divider>
              <el-table :data="form2.referees" border style="width: 100%">
                <el-table-column prop="name" label="裁判姓名" width="180">
                </el-table-column>
                <el-table-column prop="sex" label="性别" width="180">
                </el-table-column>
                <el-table-column prop="age" label="年龄" width="180">
                </el-table-column>
                <el-table-column prop="tel" label="电话" width="180">
                </el-table-column>
                <el-table-column prop="idCard" label="身份证">
                </el-table-column>
              </el-table>
              <el-divider>随队人员</el-divider>
              <el-table :data="form2.others" border style="width: 100%">
                <el-table-column prop="name" label="随队人员姓名" width="180">
                </el-table-column>
                <el-table-column prop="sex" label="性别" width="180">
                </el-table-column>
                <el-table-column prop="age" label="年龄" width="180">
                </el-table-column>
                <el-table-column prop="tel" label="电话" width="180">
                </el-table-column>
                <el-table-column prop="idCard" label="身份证">
                </el-table-column>
              </el-table>

              <!-- <el-form-item label="领队ids" prop="leaderIds">
          <el-input
            v-model="form.leaderIds"
            type="textarea"
            placeholder="请输入内容"
          />
        </el-form-item> -->
              <div>
                <el-divider>比赛项目</el-divider>
                <el-collapse>
                  <el-collapse-item
                    v-for="item in form2.projects"
                    :key="item.id"
                    :title="item.name"
                  >
                    <template slot="title">
                      {{ item.type }} - {{ item.projectName }} -
                      {{ item.groups }}
                    </template>
                    <div>运动员信息： 姓名——性别——年龄——身份证——电话</div>
                    <div
                      v-for="tag in item.athletes"
                      :key="tag.index"
                      type="info"
                      size="small"
                    >
                      <el-tag type="info">
                        {{
                          tag.name +
                          "—" +
                          tag.sex +
                          "—" +
                          tag.age +
                          "—" +
                          tag.idCard +
                          "—" +
                          tag.tel
                        }}
                      </el-tag>
                    </div>
                    <div>
                      比赛音乐：<el-tag>{{ item.fileMusicName }}</el-tag>
                    </div>
                  </el-collapse-item>
                </el-collapse>

                <el-divider>状态信息</el-divider>
                <el-form-item label="报名状态" prop="status">
                  <el-popover trigger="hover" placement="top">
                    <div slot="reference" class="name-wrapper">
                      <el-tag
                        v-show="form2.status === '已退回'"
                        size="medium"
                        type="danger"
                        >{{ form2.status }}</el-tag
                      >

                      <el-tag
                        v-show="form2.status === '待审核'"
                        size="medium"
                        type="warning"
                        >{{ form2.status }}</el-tag
                      >
                      <el-tag
                        v-show="form2.status === '已通过'"
                        size="medium"
                        type="success"
                        >{{ form2.status }}</el-tag
                      >
                      <el-tag
                        v-show="form2.status === '待缴费'"
                        size="medium"
                        type=""
                        >{{ form2.status }}</el-tag
                      >
                      <el-tag
                        v-show="form2.status === '草稿'"
                        size="medium"
                        type="info"
                        >{{ form2.status }}</el-tag
                      >
                    </div>
                  </el-popover>
                </el-form-item>
                <el-form-item
                  label="审核"
                  prop="status"
                  v-if="form2.status == '已通过'"
                >
                  <!-- <el-button
                  type="success"
                  :disabled="form2.status === '已通过'"
                  @click="submitYes"
                  >审核通过</el-button
                > -->
                  <el-button type="danger" @click="submitNo2">退回</el-button>
                </el-form-item>

                <el-form-item
                  label="审核"
                  prop="status"
                  v-if="form2.status == '待审核'"
                >
                  <el-button
                    type="success"
                    :disabled="form2.status === '已通过'"
                    @click="submitYes2"
                    >审核通过</el-button
                  >
                  <el-button
                    type="warning"
                    :disabled="form2.status === '待缴费'"
                    @click="noPay2"
                    >待缴费</el-button
                  >
                  <el-button
                    type="danger"
                    :disabled="form2.status === '已退回'"
                    @click="submitNo2"
                    >退回</el-button
                  >
                </el-form-item>

                <el-form-item
                  label="审核"
                  prop="status"
                  v-if="form2.status == '待缴费'"
                >
                  <el-button
                    type="success"
                    :disabled="form2.status === '已通过'"
                    @click="submitYes2"
                    >审核通过</el-button
                  >
                  <el-button
                    type="danger"
                    :disabled="form2.status === '已退回'"
                    @click="submitNo2"
                    >退回</el-button
                  >
                </el-form-item>

                <el-form-item
                  label="审核失败退回原因"
                  v-if="
                    form2.status === '已通过' ||
                    form2.status === '待审核' ||
                    form2.status === '待缴费'
                  "
                >
                  <el-input
                    v-model="submitForm.rejectCause"
                    placeholder="请输入审核失败原因"
                  />
                </el-form-item>
              </div>
            </el-form>
            <!-- <el-form ref="submitForm" :model="submitForm" label-width="80px">
      
        </el-form> -->
          </el-scrollbar>
          <div slot="footer" class="dialog-footer">
            <!-- <el-button type="primary" @click="submitForm">确 定</el-button> -->
            <el-button @click="cancel2">关 闭</el-button>
          </div>
        </el-dialog></el-tab-pane
      >
      <!-- <el-tab-pane label="角色管理">角色管理</el-tab-pane>
      <el-tab-pane label="定时任务补偿">定时任务补偿</el-tab-pane> -->
    </el-tabs>
  </div>
</template>

<script>
import {
  listApply,
  getApply,
  delApply,
  addApply,
  updateApply,
  listplay,
  submit,
  listApplyInfo,
  delApplyInfo,
  delApplyInfos,
  updateStatus,
} from "@/api/game/apply";

export default {
  name: "Apply",
  data() {
    return {
      options: [
        {
          id: 0,
          value: "草稿",
          label: "草稿",
        },
        {
          id: 1,
          value: "待缴费",
          label: "待缴费",
        },
        {
          id: 2,
          value: "待审核",
          label: "待审核",
        },
        {
          id: 3,
          value: "已退回",
          label: "已退回",
        },
        {
          id: 4,
          value: "已通过",
          label: "已通过",
        },
      ],
      BaseUrl: process.env.VUE_APP_BASE_API,
      // 遮罩层
      loading: true,
      loading2: true,
      // 选中数组
      ids: [],
      ids2: [],
      // 非单个禁用
      single: true,
      single2: true,
      // 非多个禁用
      multiple: true,
      multiple2: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      total2: 0,
      // 报名审核数据
      applyList: [],
      //报名列表
      applyInfoList: [],
      // 弹出层标题
      title: "",
      title2: "",
      // 是否显示弹出层
      open: false,
      open2: false,
      // 查询参数
      queryPlayParams: {
        page: 1,
        rowsPerPage: 999,
      },
      queryParams: {
        page: 1,
        rowsPerPage: 10,
        title: null,
        competitionId: null,
        // leaderIds: null,
        // coachIds: null,
        // refereeIds: null,
        // otherIds: null,
        // joinTime: null,
        // singleRoomPresonSum: null,
        // standardRoomPersonSum: null,
        // entryCost: null,
        // cost: null,
        // province: null,
        // status: null,
        // createBy: null,
        // createTime: null,
        // updateBy: null,
        // updateTime: null,
        // sort: null,
      },
      queryParams2: {
        page: 1,
        rowsPerPage: 10,
        title: null,
        competitionId: null,
        status: null,
      },
      shenheStatus: [
        {
          value: 0,
          label: "草稿",
        },
        {
          value: 1,
          label: "待缴费",
        },
        {
          value: 2,
          label: "待审核",
        },
        {
          value: 3,
          label: "已退回",
        },
        {
          value: 4,
          label: "已通过",
        },
      ],
      // 表单参数
      form: {},
      form2: {},
      submitForm: {
        id: null,
        rejectCause: null,
        result: null,
      },
      // 表单校验
      rules: {},
      // 比赛列表
      playList: [],
    };
  },
  created() {
    this.getList();
    this.getPlayList();
    this.getListInfo();
  },
  methods: {
    // 审核
    submitYes() {
      this.submitForm.result = "yes";
      submit(this.submitForm).then((res) => {
        if (res.code == 200) {
          this.getStatus(this.submitForm.id);
          this.$modal.msgSuccess("审核通过!");
        }
        // updateApply;
        this.getListInfo();
        this.getList();
      });
    },

    submitYes2() {
      this.submitForm.result = "yes";
      submit(this.submitForm).then((res) => {
        if (res.code == 200) {
          this.getStatus2(this.submitForm.id);
          this.$modal.msgSuccess("审核通过!");
        }
        // updateApply;
        this.getListInfo();
        this.getList();
      });
    },

    submitNo() {
      this.submitForm.result = "no";
      submit(this.submitForm).then((res) => {
        if (res.code == 200) {
          this.getStatus(this.submitForm.id);
          this.$modal.msgSuccess("已退回!");
        }
        this.getListInfo();
        this.getList();
        this.submitForm.rejectCause = "";
      });
    },

    submitNo2() {
      this.submitForm.result = "no";
      submit(this.submitForm).then((res) => {
        if (res.code == 200) {
          this.getStatus2(this.submitForm.id);
          this.$modal.msgSuccess("已退回!");
        }
        this.getListInfo();
        this.getList();
        this.submitForm.rejectCause = "";
      });
    },

    noPay() {
      let status = "待缴费";
      updateStatus(this.submitForm.id, status).then((response) => {
        this.$modal.msgSuccess("修改成功");
        this.getStatus(this.form.id);
        this.getListInfo();
        this.getList();
      });
    },

    noPay2() {
      let status = "待缴费";
      updateStatus(this.submitForm.id, status).then((response) => {
        this.$modal.msgSuccess("修改成功");
        this.getStatus2(this.form2.id);
        this.getListInfo();
        this.getList();
      });
    },

    // submitNo2() {
    //   this.submitForm.result = "no";
    //   submit(this.submitForm).then((res) => {
    //     if (res.code == 200) {
    //       getApply(this.submitForm.id).then((response) => {
    //         this.form2.status = response.data.status;
    //       });
    //       this.$modal.msgSuccess("已退回!");
    //     }
    //     this.getListInfo();
    //     this.getList();
    //     this.submitForm.rejectCause = "";
    //   });
    // },

    //获取状态
    getStatus(id) {
      getApply(id).then((response) => {
        this.form.status = response.data.status;
      });
    },
    getStatus2(id) {
      getApply(id).then((response) => {
        this.form2.status = response.data.status;
      });
    },
    /** 查询比赛列表 */
    getPlayList() {
      // this.loading = true;
      listplay(this.queryPlayParams).then((response) => {
        this.playList = response.data.list;
        console.log(this.playList);
        // this.total = response.data.totalCount;
        // this.loading = false;
      });
    },
    /** 查询审核列表 */
    getList() {
      this.loading = true;
      listApply(this.queryParams).then((response) => {
        this.applyList = response.data.list;
        this.total = response.data.totalCount;
        this.loading = false;
      });
    },

    // 获取报名列表
    getListInfo() {
      this.loading2 = true;
      listApplyInfo(this.queryParams2).then((response) => {
        this.applyInfoList = response.data.list;
        this.total2 = response.data.totalCount;
        this.loading2 = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
      this.getList();
    },
    //报名信息取消
    cancel2() {
      this.open2 = false;
      this.reset2();
      this.getListInfo();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        title: null,
        competitionId: null,
        competitionName: null,
        leaderIds: null,
        coachIds: null,
        refereeIds: null,
        otherIds: null,
        joinTime: null,
        singleRoomPresonSum: null,
        standardRoomPersonSum: null,
        entryCost: null,
        cost: null,
        province: null,
        status: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        sort: null,
      };
      this.submitForm = {
        id: null,
        rejectCause: null,
        result: null,
      };
      this.resetForm("form");
    },
    reset2() {
      this.form2 = {
        id: null,
        title: null,
        competitionId: null,
        competitionName: null,
        leaderIds: null,
        coachIds: null,
        refereeIds: null,
        otherIds: null,
        joinTime: null,
        singleRoomPresonSum: null,
        standardRoomPersonSum: null,
        entryCost: null,
        cost: null,
        province: null,
        status: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        sort: null,
      };
      this.resetForm("form2");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      // this.queryParams.page = 1;
      // this.getList();
      this.getList();
    },
    handleQuery2() {
      this.queryParams2.page = 1;
      this.getListInfo();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams.title = null;
      this.queryParams.competitionId = null;
      this.resetForm("queryForm");
      this.handleQuery();
    },

    resetQuery2() {
      this.queryParams2.title = null;
      this.queryParams2.competitionId = null;
      this.queryParams2.status = null;

      this.resetForm("queryApplyForm");
      this.handleQuery2();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    handleSelectionChange2(selection) {
      this.ids2 = selection.map((item) => item.id);
      this.single2 = selection.length !== 1;
      this.multiple2 = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "审核信息";
    },
    /** 审核 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      this.submitForm.id = row.id || this.ids;
      getApply(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "审核";
      });
    },
    /** 修改报名 */
    handleUpdate2(row) {
      this.reset2();
      const id = row.id || this.ids;
      this.submitForm.id = row.id || this.ids;
      getApply(id).then((response) => {
        this.form2 = response.data;
        this.open2 = true;
        this.title2 = "报名信息";
      });
    },

    /** 提交按钮 */
    submitForm2() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateApply(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addApply(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除报名编号为"' + ids + '"的数据项？')
        .then(function () {
          return delApply(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },

    handleDelete2(row) {
      if (row.id) {
        const id = row.id;
        this.$modal
          .confirm('是否确认删除报名编号为"' + id + '"的数据项？')
          .then(function () {
            return delApplyInfo(id);
          })
          .then(() => {
            this.getListInfo();
            this.$modal.msgSuccess("删除成功");
          })
          .catch(() => {});
      } else if (!row.id && this.ids2) {
        const ids = this.ids2.join(",");
        this.$modal
          .confirm('是否确认删除报名编号为"' + ids + '"的数据项？')
          .then(function () {
            return delApplyInfos(ids);
          })
          .then(() => {
            this.getListInfo();
            this.$modal.msgSuccess("删除成功");
          })
          .catch(() => {});
      }
    },

    /** 导出按钮操作 */
    // handleExport() {
    //   this.download(
    //     "system/apply/export",
    //     {
    //       ...this.queryParams,
    //     },
    //     `apply_${new Date().getTime()}.xlsx`
    //   );
    // },

    /** 男女运动员表 */
    exportAthletes() {
      if (!this.queryParams2.competitionId) {
        this.$modal.msgError("请先选择赛事");
      } else {
        this.downloadFile(
          "/work/export/exportSexAthleteSum",
          {
            competitionId: this.queryParams2.competitionId,
            status: this.queryParams2.status,
            title: this.queryParams2.title,
          },
          `男女运动员表_${
            new Date().getFullYear() +
            "-" +
            (new Date().getMonth() + 1) +
            "-" +
            new Date().getDate()
          }.xlsx`
        );
      }
    },
    //  导出随队裁判
    exportReffers() {
      if (!this.queryParams2.competitionId) {
        this.$modal.msgError("请先选择赛事");
      } else {
        this.downloadFile(
          "/work/export/exportReferee",
          {
            competitionId: this.queryParams2.competitionId,
            status: this.queryParams2.status,
            title: this.queryParams2.title,
          },
          `随队裁判表_${
            new Date().getFullYear() +
            "-" +
            (new Date().getMonth() + 1) +
            "-" +
            new Date().getDate()
          }.xlsx`
        );
      }
    },
    //  导出随队教练
    exportCoachs() {
      if (!this.queryParams2.competitionId) {
        this.$modal.msgError("请先选择赛事");
      } else {
        this.downloadFile(
          "/work/export/exportCoach",
          {
            competitionId: this.queryParams2.competitionId,
            status: this.queryParams2.status,
            title: this.queryParams2.title,
          },
          `随队教练表_${
            new Date().getFullYear() +
            "-" +
            (new Date().getMonth() + 1) +
            "-" +
            new Date().getDate()
          }.xlsx`
        );
      }
    },

    // 费用表
    exportCost() {
      if (!this.queryParams2.competitionId) {
        this.$modal.msgError("请先选择赛事");
      } else {
        this.downloadFile(
          "/work/export/exportCost",
          {
            competitionId: this.queryParams2.competitionId,
            status: this.queryParams2.status,
            title: this.queryParams2.title,
          },
          `费用表_${
            new Date().getFullYear() +
            "-" +
            (new Date().getMonth() + 1) +
            "-" +
            new Date().getDate()
          }.xlsx`
        );
      }
    },

    // 单位表
    exportDanWei() {
      if (!this.queryParams2.competitionId) {
        this.$modal.msgError("请先选择赛事");
      } else {
        this.downloadFile(
          "/work/export/exportApplyUnit",
          {
            competitionId: this.queryParams2.competitionId,
            status: this.queryParams2.status,
            title: this.queryParams2.title,
          },
          `单位表_${
            new Date().getFullYear() +
            "-" +
            (new Date().getMonth() + 1) +
            "-" +
            new Date().getDate()
          }.xlsx`
        );
      }
    },

    // 随队人员
    exportSuiDui() {
      if (!this.queryParams2.competitionId) {
        this.$modal.msgError("请先选择赛事");
      } else {
        this.downloadFile(
          "/work/competition/exportFollowOthers",
          {
            competitionId: this.queryParams2.competitionId,
            status: this.queryParams2.status,
            title: this.queryParams2.title,
          },
          `随队人员表_${
            new Date().getFullYear() +
            "-" +
            (new Date().getMonth() + 1) +
            "-" +
            new Date().getDate()
          }.xlsx`
        );
      }
    },

    exportAllPeople() {
      if (!this.queryParams2.competitionId) {
        this.$modal.msgError("请先选择赛事");
      } else {
        this.downloadFile(
          "/work/export/exportAllAthlete",
          {
            competitionId: this.queryParams2.competitionId,
            // status: this.queryParams2.status,
            // title: this.queryParams2.title,
          },
          `所有运动员表_${
            new Date().getFullYear() +
            "-" +
            (new Date().getMonth() + 1) +
            "-" +
            new Date().getDate()
          }.xlsx`
        );
      }
    },

    // 综合报名表
    exportZongHe() {
      if (!this.queryParams2.competitionId) {
        this.$modal.msgError("请先选择赛事");
      } else {
        this.downloadFile(
          "/work/export/exportComprehensive",
          {
            competitionId: this.queryParams2.competitionId,
            status: this.queryParams2.status,
            title: this.queryParams2.title,
          },
          `综合报名表_${
            new Date().getFullYear() +
            "-" +
            (new Date().getMonth() + 1) +
            "-" +
            new Date().getDate()
          }.xlsx`
        );
      }
    },
  },
};
</script>
